﻿using System;
using System.Linq.Expressions;
using System.Web.Mvc;

namespace Infrastructure.Web.Mvc.Extensions
{
    public static class ControllerExtensions
    {
        public static void RedirectToAction<TController>(this ControllerBase controller, Expression<Action<TController>> expression)
            where TController : Controller
        {
            new RedirectToRouteResult(Utils.GetRouteValuesFromExpression<TController>(expression)).ExecuteResult(controller.ControllerContext);
        }
    }
}
